<template>
	<view class="">
		<cu-navbar :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">意见反馈</block>
		</cu-navbar>
		<view class="padding-lr">
			<view class="cu-form-group margin-top"><textarea maxlength="-1" placeholder="意见反馈" v-model="content"></textarea></view>
		</view>
		<view class="padding flex flex-direction"><button class="cu-btn bg-mauve margin-tb-sm lg" @click="feedback">提交反馈</button></view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			content: ''
		};
	},
	methods: {
		feedback() {
			if (!this.content) {
				this.$common.errorToShow('请输入反馈内容');
				return;
			}
			this.$api.addfeedback({ content: this.content }).then(res => {
				if (res.code) {
					this.$common.successToShow(res.msg, () => {
						uni.navigateBack({
							delta: 1
						});
					});
				} else {
					this.$common.errorToShow(res.msg);
				}
			});
		}
	}
};
</script>

<style>
page {
	background-color: #f4f6f8;
}
</style>
